//
//  FirstViewController.m
//  LianXi7.11
//
//  Created by apple on 2017/7/12.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "FirstViewController.h"
#import "ViewController.h"
#import "PreURLViewController.h"
#import "DuanDianURLViewController.h"
#import "OffLineViewController.h"
#import "AFNetworkingOnLineViewController.h"
#import "HMSegmentedControlViewController.h"
#import "CellListViewController.h"
@interface FirstViewController ()

@property (nonatomic, strong) NSArray *arr;

@property (nonatomic, strong) NSArray *arrVC;

@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    ViewController *vc = [[ViewController alloc] init];
    PreURLViewController *pVC = [[PreURLViewController alloc] init];
    DuanDianURLViewController *dVC = [[DuanDianURLViewController alloc] init];
    OffLineViewController *oVC = [[OffLineViewController alloc] init];
    AFNetworkingOnLineViewController *aVC = [[AFNetworkingOnLineViewController alloc] init];
    HMSegmentedControlViewController *hVC = [[HMSegmentedControlViewController alloc] init];
    CellListViewController *cellVC = [[CellListViewController alloc] init];
    
    self.arrVC = @[vc, pVC, dVC, oVC, aVC, hVC, cellVC];
    
    self.arr = @[@"下载", @"带进度条", @"断点下载", @"离线", @"AFN", @"分段式控制器", @"cell下拉"];
    
    for (int i = 0; i < _arr.count; i++) {
        
        UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(10, 80*i, 200, 40)];
        
        [btn setTitle:_arr[i] forState:UIControlStateNormal];
        [btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
        
        btn.tag = i;
        
        [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        
        [self.view addSubview:btn];
    }
}

- (void)btnClick:(UIButton *)sender{
    
    long int i = [sender tag];
    
    for (int l = 0; l < _arr.count; l++) {
        
        if (i == l) {
            
            [self presentViewController:_arrVC[i] animated:YES completion:nil];
        }
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
